package com.kpmg.datalake.autopackage.vo;

import com.alibaba.fastjson.JSONObject;

public class ResultData {

	private ResultData() {}
	
	public static JSONObject getSuccess(Object msg, Object data) {
		return getResult("200", true, msg, data);
	}
	
	public static JSONObject getSuccess(Object msg) {
		return getResult("200", true, msg, null);
	}
	
	public static JSONObject getFail(Object code, Object msg) {
		return getResult(code, false, msg, null);
	}
	
	public static JSONObject getResult(Object code, Object success, Object msg, Object data) {
		JSONObject res = new JSONObject();
		res.put("code", code);
		res.put("success", success);
		res.put("msg", msg);
		if(data!=null) {
			res.put("data", data);
		}
		return res;
	}
}
